package Hot100.Greedy_algorithm;

public class maxProfit_2 {
    public static void main(String[] args) {

    }
    public int maxProfit(int[] prices) {

        int max_profit = 0;
        for (int i = 1; i < prices.length; i++) {
            if(prices[i] - prices[i - 1] > 0){
                max_profit += prices[i] - prices[i - 1];
            }
        }
        return max_profit;
    }
}
